//
//  CityCell.swift
//  KaMengApplication
//
//  Created by DUONIU_MAC on 2018/9/12.
//  Copyright © 2018年 DUONIU_MAC. All rights reserved.
//

import UIKit

class CityCell: UITableViewCell {

    fileprivate let titleLabel = UILabel()
    
    var model : CityModel! {
        
        didSet{
            updateData()
        }
    }
    
    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        
        self.contentView.backgroundColor = UIColor.clear
        
        titleLabel.font = UIFont.systemFont(ofSize: RATIO(maxNum: 16))
        self.contentView.addSubview(titleLabel)
        
        let grayView = UIView()
        grayView.backgroundColor = UIColor.lineColor()
        self.contentView.addSubview(grayView)
        
        titleLabel.snp.makeConstraints { (make) in
            make.centerY.equalToSuperview()
            make.left.equalToSuperview().offset(RATIO(maxNum: 8))
            make.width.greaterThanOrEqualTo(10)
            make.height.greaterThanOrEqualTo(10)
        }
        
        grayView.snp.makeConstraints { (make) in
            make.left.right.bottom.equalToSuperview()
            make.height.equalTo(1)
        }
    }
    
    //MARK: 更新数据
    fileprivate func updateData() {
        
        titleLabel.text = model.name
        
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }

}
